import 'package:android_intent_plus/android_intent.dart';

import '../../common/utils/toast.dart';

void goWifiSettings() {
  const intent = AndroidIntent(
    action: 'android.settings.WIFI_SETTINGS',
  );
  intent.launch();
}

void shareText(String text) async {
  final intent = AndroidIntent(
    action: 'android.intent.action.SEND',
    category: 'android.intent.category.DEFAULT',
    type: 'text/plain',
    arguments: {
      'android.intent.extra.SUBJECT': 'Share With Friend',
      'android.intent.extra.TEXT': text,
    },
  );
  final bool canResolve = await intent.canResolveActivity() == true;
  if (canResolve) {
    intent.launchChooser('Choose an app');
  } else {
    showToast('No apps can perform this action');
  }
}
